/*
 * Copyright (c) ShaoxiongDu <Shaoxiong.dev@aliyun.com> 2021 all Rights Reserved
 */

package zh.codegym.task.task10.task1019;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

/* 
功能还不够！
*/

public class Solution {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        HashMap<String, Integer> integerStringHashMap = new HashMap<String, Integer>();
        String name;
        int id;
        while (true) {
            String value = reader.readLine();
            if (value.isEmpty()) {
                break;
            }
            id = Integer.parseInt(value);
            name = reader.readLine();
//            if (name.isEmpty()){
//                break;
//            }
            integerStringHashMap.put(name, id);
        }

        for (Map.Entry item : integerStringHashMap.entrySet()) {
            System.out.println(item.getValue() + " " + item.getKey());
        }


    }
}
